预览:我们已经知道如何创建一个列表并使用循环访问该列表中的每个项目。
但是,如果您只想使用列表中的一项怎么办?为此,您使用索引。
To navigate the page using the TAB key, first press ESC to exit the code editor.
预览:我们已经知道如何创建一个列表并使用循环访问该列表中的每个项目。
但是,如果您只想使用列表中的一项怎么办?为此,您使用索引。
To navigate the page using the TAB key, first press ESC to exit the code editor.
Your micro:bit is not set up for this program. Follow these steps to use your device with Codesters:
Your micro:bit has an old version of the Codesters binary file. Follow these steps to update the file on your micro:bit:
Warning: This will erase any existing program on your micro:bit.
Having trouble? Check out the micro:bit instructions to update your firmware.
Setting up your micro:bit
Calibrate your micro:bit by tilting it until all the LEDs are lit.
For a demonstration see the micro:bit calibration instructions.
Try the following steps to connect to your Micro:bit:
1. You may need to reload this page and try your program again.
2. Try disconnecting and reconnecting your Micro:bit. Then reload the page and run your program again.
3. If you are still having problems your Micro:bit may have an old firmware version that is incompatible with Codesters.
To update the firmware follow these Micro:bit instructions.
Are you already running a Codesters project in another tab or window?
Micro:bit can only connect to one web page at a time. Try stopping other Codesters projects or closing other tabs or windows that may be using your Micro:bit.
If that doesn't fix the problem try disconnecting your Micro:bit, reloading this page, and reconnecting your Micro:bit.
Status: Connected!
Status: Connecting...
Status: Still connecting...
Status: Failure
Status: Not Found
Is your Micro:bit connected?
欢迎来到 Python 2 简介!在本模块中,您将学到很多关于如何使您的代码更整洁、更高效和更强大的知识。
回想一下您在 Python 1 简介中使用过列表。列表是按特定顺序存储的一组项目。在本课中,您将探索我们如何使用索引来引用列表中的各个项目。索引是项目在列表中的位置。
您将使用一组特殊的精灵,这些精灵被分成三个部分:头部、中部和腿部。通过使用不同的索引,您将制作一个程序来混合和匹配不同的精灵部分以创建一个古怪的图片!
学习目标:
学生将能够:
项目示例: